{% set page_name = "编辑徽章" %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
    <div class="medium-9 columns">
        <div class="section">
            <div class="section__header">
                <h2 class="section__title">{{ _('编辑徽章') }}</h2>
            </div>
            <div class="section__body">
                <form method="post">
                    {{ form.form_text({
                        columns:12,
                        label:('{0}(另作徽章悬停时内容)').format(_('徽章标题')),
                        name:'title',
                        placeholder:('显示名，建议3字以内'),
                        value:badge.title|default(''),
                        autofocus:true
                    }) }}
                    <div class="row">
                    {{ form.form_text({
                        columns:3,
                        label:'徽章简称',
                        name:'short',
                        placeholder:_('十六进制颜色代码'),
                        value:badge.short|default(''),
                        autofocus:true,
                        row:false
                    }) }}
                    {{ form.form_text({
                        columns:3,
                        label:'徽章背景色',
                        name:'backgroundColor',
                        placeholder:_('十六进制颜色代码'),
                        value:badge.backgroundColor|default(''),
                        autofocus:true,
                        row:false
                    }) }}
                    {{ form.form_text({
                        columns:3,
                        label:'徽章字体色',
                        name:'fontColor',
                        placeholder:_('十六进制颜色代码'),
                        value:badge.fontColor|default(''),
                        autofocus:true,
                        row:false
                    }) }}
                    </div>
                    {{ form.form_text({
                        columns:12,
                        label:'徽章分配',
                        name:'users',
                        help_text:_('徽章欲分配的用户'),
                        value:badge.users|default('')
                    }) }}
                    {{ form.form_textarea({
                        columns:null,
                        label:'Description',
                        name:'content',
                        value:badge.content|default(''),
                        markdown:true
                    }) }}
                    <button name="operation" value="update" type="submit" class="rounded primary button">
                    {{ _('Update') }}
                    </button>
                    <button name="operation" value="delete" type="submit" class="rounded button">
                    {{ _('Delete') }}
                    </button>
                    <button type="button" class="rounded button" onclick="window.history.go(-1)">
                    {{ _('Cancel') }}
                    </button>
                </form>
            </div>
        </div>
    </div>
    <div class="medium-3 columns">
        {% include 'components/md_hint.html' %}
    </div>
</div>
{% endblock %}